﻿namespace EntityFramework.FullText.Samples
{
    using EntityFramework.FullText.Samples.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Core.Objects;
    using System.Data.Entity.Infrastructure;
    using System.Data.Entity.Utilities;
    using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            var dbContextInfo = new FullTextContextInfo<Entities>(
                @"Data Source=.\SQLEXPRESS;Initial Catalog=EntityFrameworkFTS.Samples;Integrated Security=True");

            using (var context = (Entities)dbContextInfo.CreateInstance())
            {
                var q = context.DbSearch<Document>("doc").OrderBy(d => d.ID);

                Console.WriteLine(((ObjectQuery)q).ToTraceString());
                Console.WriteLine();
                Console.WriteLine(q.Count());
            }

            Console.WriteLine();
            Console.WriteLine("Press a key...");
            Console.ReadKey(false);
        }
    }
}
